<?php
//初始化
$v8 = new V8Js();

//js代码
$js = "
    var char = 'abcdef';
    var password = '123456';
    function sign(char,password)
    {
        return char+password;
    }
    var token = sign(char,password);
    token;
";

//尝试执行js
try
{
    $ret = $v8->executeString($js, 'auth.js');
    echo '执行成功:' . PHP_EOL;
    var_dump($ret);
}
catch (Exception $e)
{
    echo '代码异常' . PHP_EOL;
    var_dump($e->getMessage());
}